<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!-- <script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
		<script type="text/javascript" language="javascript" src="http://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>
		<script type="text/javascript" language="javascript" src="http://cdn.datatables.net/plug-ins/725b2a2115b/integration/bootstrap/3/dataTables.bootstrap.js"></script>
		
<link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/plug-ins/725b2a2115b/integration/bootstrap/3/dataTables.bootstrap.css">
		<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/tabletools/2.2.2/css/dataTables.tableTools.css">
		<link rel="stylesheet" type="text/css" href="http://editor.datatables.net/examples/resources/bootstrap/editor.bootstrap.css">

-->



</head>
<style>
</style>
<script>
	$(document).ready(function() {
		var table = $('#addressTable').DataTable();

		$('#addressTable tbody').on('click', 'tr', function() {
			if ($(this).hasClass('active')) {
				$(this).removeClass('active');
			} else {
				table.$('tr.active').removeClass('active');
				$(this).addClass('active');
			}
		});

		$("#addressTable tr").css('cursor', 'pointer');

		$('#addressTable tbody tr').click(function() {
			var x = $(this).attr("name");
			//alert(x);
			$('#addressIDval').val(x);
			$('#addressIDval').text(x);

		});
	});
</script>
<body>
	<div style="width: 800px; height: 600px; margin: 0 auto;">
		<table id="addressTable" class="table table-striped table-bordered"
			cellspacing="0" width="100%">
			<thead>
				<tr>
					<th>Street</th>
					<th>PostCode</th>
					<th>Town</th>
					<th>County</th>
					<th>Country</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${listAddress}" var="address">
					<tr name="address-${address.addressID}">
						<td id="street">${address.street}</td>
						<td id="postCode${address.addressID}">${address.postCode}</td>
						<td id="townName${address.addressID}">${address.town.townName}</td>
						<td id="countyName${address.addressID}">${address.county.countyName}</td>
						<td id="countryName${address.addressID}">${address.country.countryName}</td>
					</tr>
				</c:forEach>
			<tbody>
			</tbody>
		</table>
	</div>
	<div id="addressIDval" style="display: '';"></div>
</body>
</html>
